package fire.combat;

import jgame.JGColor;
import jgame.JGObject;
import jgame.platform.JGEngine;

import fire.pet.Pet;
import fire.skill.FireBall;

public class CombatPet extends JGObject {
	private Pet pet;

	public CombatPet(String name, boolean unique_id, double x, double y,
			int collisionid, String gfxname, Pet pet) {
		super(name, unique_id, x, y, collisionid, gfxname);
		this.pet = pet;
	}

	public Pet getPet() {
		return pet;
	}

	public void setPet(Pet pet) {
		this.pet = pet;
	}

	@Override
	public void paint(JGEngine g) {
		int x = (int) this.x + getBBox().width / 4;
		g.drawRect(x - 5, y - 5, 110, 20, true, false, 0, JGColor.red);
		if (pet.getHp() > 0) {
			g.drawRect(x, y, pet.getHp(), 10, true, false, 0, JGColor.green);
		}
	}

	public void beHit(int i) {
		this.pet.beHit(i);
	}

	public void attack(CombatPet player, CombatPet enemy) {
		new FireBall(player.x, player.y, enemy, pet.getStrength());
	}

}
